<template>
  <div class="app-container">
    <h3>角色权限</h3>
    <el-table :data="rolesList" border style="width: 100%">
      <el-table-column prop="name" label="角色名" />
      <el-table-column prop="description" label="描述" />
      <el-table-column label="操作">
        <template #default="scope">
          <el-button type="primary" size="small" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

interface Role {
  name: string
  description: string
}

const rolesList = ref<Role[]>([
  { name: 'admin', description: '管理员' },
  { name: 'editor', description: '编辑' }
])

const handleEdit = (row: Role) => {
  console.log('编辑', row)
}

const handleDelete = (row: Role) => {
  console.log('删除', row)
}
</script>

<style lang="scss" scoped>
.app-container {
  padding: 20px;
}
</style> 